package com.gitee.minimalismstyle.fresh.simple.api.service

import com.gitee.minimalismstyle.fresh.common.api.annotation.ControllerFeignClient
import com.gitee.minimalismstyle.fresh.common.core.domain.R
import com.gitee.minimalismstyle.fresh.simple.api.config.SimpleApiConst
import com.gitee.minimalismstyle.fresh.simple.api.model.TableColumnSchema
import com.gitee.minimalismstyle.fresh.simple.api.model.TableSchema
import io.swagger.annotations.Api
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable

@Api(value = "database", tags = ["数据库接口"])
@ControllerFeignClient(serviceId = SimpleApiConst.SERVICE_ID, ctx =SimpleApiConst.CTX, path = "/database")
interface DatabaseService {

    @GetMapping("findAllTable/{datasourceId}")
    fun findAllTable(@PathVariable datasourceId: Long): R<List<TableSchema>>

    @GetMapping("findTable/{datasourceId}/{name}")
    fun findTableByName(@PathVariable datasourceId: Long, @PathVariable name: String): R<TableSchema>

    @GetMapping("findColumns/{datasourceId}/{name}")
    fun findColumnsByName(@PathVariable datasourceId: Long, @PathVariable name: String): R<List<TableColumnSchema>>
}